package com.luych.toolbox.common.feign.intf.base.service;

import com.luych.toolbox.common.constant.PageConstant;
import com.luych.toolbox.common.feign.FeignInterface;
import com.luych.toolbox.common.feign.param.base.service.ScriptParam;
import com.luych.toolbox.common.feign.view.base.service.ScriptTypeView;
import com.luych.toolbox.common.feign.view.base.service.ScriptView;
import com.luych.toolbox.common.page.CommonPageResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(contextId = "base-service-script", name = "base-service", path = "/script", decode404 = true)
public interface ScriptFeign extends FeignInterface<ScriptView, ScriptParam> {

    @ApiOperation("按关键字查询")
    @GetMapping("/search/keyword")
    CommonPageResult<ScriptView> pageByKeyword(
            @ApiParam(value = "每页容量") @RequestHeader(name = "pageSize", required = false, defaultValue = PageConstant.DEFAULT_PAGE_SIZE_STR) long pageSize,
            @ApiParam(value = "查询页码") @RequestHeader(name = "pageNumber", required = false, defaultValue = PageConstant.DEFAULT_PAGE_NUMBER_STR) long pageNumber,
            @ApiParam(value = "排序字段") @RequestHeader(name = "sort", required = false, defaultValue = PageConstant.DEFAULT_PAGE_SORT) String sort,
            @ApiParam(value = "正序/倒序，取值ASC/DESC") @RequestHeader(name = "order", required = false, defaultValue = PageConstant.DEFAULT_PAGE_ORDER) String order,
            @ApiParam(value = "查询关键字") @RequestParam(name = "keyword", required = false) String keyword
    );

    @ApiOperation("查询脚本类型")
    @GetMapping("/type")
    CommonPageResult<ScriptTypeView> listType();
}
